﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CCWin;

namespace DC.Views
{
    public partial class Form_ProjectFatherEdit : Skin_DevExpress
    {
        Utils.Database DB = Utils.Global.GlobalDB;

        public List<int> range = new List<int>();
        public Form_ProjectFatherEdit()
        {
            InitializeComponent();
        }

        private void Form_ProjectFatherEdit_Load(object sender, EventArgs e)
        {
            loadFatherList();
        }


        private void loadFatherList()
        {
            //加载组别下拉框
            comboBox1.Items.Clear();
            DataSet FatherList = DB.GetDs("select  distinct(Project_Father) from Project");
            int Father_Rows = FatherList.Tables[0].Rows.Count;
            for (int i = 0; i < Father_Rows; i++)
            {
                comboBox1.Items.Add(FatherList.Tables[0].Rows[i][0].ToString());
            }


        }

        private void skinButton1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < range.Count; i++)
            {
                string sql = @"update Project set Project_Father='" + comboBox1.Text + "' where Project_ID ="
                                                                                       + range[i].ToString();
                DB.Execute(sql);
                
            }
            MessageBox.Show("修改成功", "组别修改", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Close();

        }
    }
}
